<html>
<head>
	<meta charset="UTF-8">
	<title>运行环境判断</title>
</head>
<body>
<hr style="border: none; border-top: 1px solid #E6E6E6;"/>
查看控制台
</body>
<script type="text/javascript">
//微信浏览器判断
function isWechat(){
	//获取user-agaent标识头
	var ua = window.navigator.userAgent.toLowerCase();
	//判断ua和微信浏览器的标识头是否匹配
	if (ua.match(/micromessenger/i) == 'micromessenger') {
		return true;
	} else {
		return false;
	}
}
// console.log(isWechat());
// alert(isWechat());

//微信或企业微信浏览器判断
function isWorkWechat(){
	//获取user-agaent标识头
	var ua = window.navigator.userAgent.toLowerCase();
	//判断ua和微信浏览器的标识头是否匹配
	if ((ua.match(/micromessenger/i) == 'micromessenger') && (ua.match(/wxwork/i) == 'wxwork')) {
		return true;
	} else {
		return false;
	}
}
// console.log(isWorkWechat());
// alert(isWorkWechat());

//移动端系统环境判断
function isMobile(){
	//获取ua
	const ua = navigator.userAgent;
	//判断是否是android
	if(ua.indexOf('Android') > -1 || ua.indexOf('Linux') > -1){
		return "Android";
	}
	//判断是否是ios
	if(navigator.platform.indexOf('iPhone') != -1){
		return "Ios";
	}
	return "PC";
}
// console.log(isMobile());
// alert(isMobile());

</script>
</html>